using System.Data.Entity.ModelConfiguration;

namespace SecondLevelCaching.Data.Models.Mapping
  {
      public class CategoryMap : EntityTypeConfiguration<Category>
      {
          public CategoryMap()
          {
              // Primary Key
              this.HasKey(t => t.CategoryID);
  
              // Properties
              this.Property(t => t.CategoryName)
                  .IsRequired()
                  .HasMaxLength(15);
  
              // Table & Column Mappings
              this.ToTable("Categories");
              this.Property(t => t.CategoryID).HasColumnName("CategoryID");
              this.Property(t => t.CategoryName).HasColumnName("CategoryName");
              this.Property(t => t.Description).HasColumnName("Description");
              this.Property(t => t.Picture).HasColumnName("Picture");
          }
      }
  }

